class HilosController < ApplicationController
  # GET /hilos
  # GET /hilos.xml
  def index
    @hilos = Hilo.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @hilos }
    end
  end

  # GET /hilos/1
  # GET /hilos/1.xml
  def show
    @hilo = Hilo.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @hilo }
    end
  end

  # GET /hilos/new
  # GET /hilos/new.xml
  def new
    @hilo = Hilo.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @hilo }
    end
  end

  # GET /hilos/1/edit
  def edit
    @hilo = Hilo.find(params[:id])
  end

  # POST /hilos
  # POST /hilos.xml
  def create
    @hilo = Hilo.new(params[:hilo])

    respond_to do |format|
      if @hilo.save
        format.html { redirect_to(@hilo, :notice => 'Hilo was successfully created.') }
        format.xml  { render :xml => @hilo, :status => :created, :location => @hilo }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @hilo.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /hilos/1
  # PUT /hilos/1.xml
  def update
    @hilo = Hilo.find(params[:id])

    respond_to do |format|
      if @hilo.update_attributes(params[:hilo])
        format.html { redirect_to(@hilo, :notice => 'Hilo was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @hilo.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /hilos/1
  # DELETE /hilos/1.xml
  def destroy
    @hilo = Hilo.find(params[:id])
    @hilo.destroy

    respond_to do |format|
      format.html { redirect_to(hilos_url) }
      format.xml  { head :ok }
    end
  end
end
